#!/bin/bash

set -e

# 编译

# # 非 phytium-pi 平台
# make A=examples/helloworld ARCH=aarch64 PLATFORM=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# # 编译失败
# make MYPLAT=axplat-aarch64-phytium-pi SMP=4 A=examples/helloworld APP_FEATURES=aarch64-phytium-pi

# # phytium-pi 平台
# make MYPLAT=axplat-aarch64-phytium-pi A=examples/helloworld-myplat APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# # make A=examples/helloworld-myplat clean

# 编译 canfd 
make MYPLAT=axplat-aarch64-phytium-pi A=examples/canfd APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# make A=examples/canfd clean

# # 编译 canfd-c
# make MYPLAT=axplat-aarch64-phytium-pi A=examples/canfd-c APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# # make A=examples/canfd-c clean

# 编译 cem5826m11
make MYPLAT=axplat-aarch64-phytium-pi A=examples/cem5826m11 APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# make A=examples/cem5826m11 clean

# 编译 fan
make MYPLAT=axplat-aarch64-phytium-pi A=examples/fan APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# make A=examples/fan clean

# 编译 led
make MYPLAT=axplat-aarch64-phytium-pi A=examples/led APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# make A=examples/led clean

# 编译 i2s_play_from_record
make MYPLAT=axplat-aarch64-phytium-pi A=examples/i2s_play_from_record APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# make A=examples/i2s_play_from_record clean

# 编译 app
make MYPLAT=axplat-aarch64-phytium-pi A=app APP_FEATURES=aarch64-phytium-pi FEATURES="irq smp" SMP=4 LOG=info
# make A=app clean

# osbool
ostool build

# #Qemu启动 ref: https://github.com/ZR233/ostool/blob/main/README.md#qemu%E5%90%AF%E5%8A%A8
# ostool run qemu
# #debug
# ostool run qemu -d

# #U-Boot 启动 ref: https://github.com/ZR233/ostool/blob/main/README.md#qemu%E5%90%AF%E5%8A%A8
# ostool run uboot

